<template>
  <div>
    <!-- 声明式导航 -->
    <router-link to="/home">去首页</router-link>
    <router-link to="/login">去登录</router-link>

    <!-- 编程式导航：导航意思：跳转 -->
    <!-- 编程式：写js代码就行跳转 -->
    <button @click="fn1">去首页</button>
    <button @click="fn2">去登录</button>
    <router-view />
  </div>
</template>

<script>
export default {

  methods: {
    fn1 () {
      // 跳转到/home路径
      this.$router.push('/home')
    },

    fn2 () {
      // 跳转到/login路径
      this.$router.push('/login')
    }
  }
}
</script>

<style>

</style>